package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.dto.NursingLevelPageQueryDto;
import com.zzyl.entity.NursingLevel;
import com.zzyl.entity.NursingPlan;
import com.zzyl.vo.NursingLevelVo;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface NursingLevelMapper {

    /**
     * 根据护理计划ID查询护理等级中的护理计划
     *
     * @param id 护理计划ID
     * @return {@code List<NursingPlan> }
     * @author YiSheep
     */
    @Select("select * from nursing_level where plan_id = #{planId}")
    List<NursingPlan> getByPlanId(Long id);

    /**
     * 分页查询护理等级信息
     *
     * @param dto 护理等级分页条件查询Dto
     * @return {@code Page<NursingLevelVo> }
     * @author YiSheep
     */
    Page<NursingLevelVo> pageQuery(NursingLevelPageQueryDto dto);

    /**
     * 插入护理等级信息
     *
     * @param nursingLevel 护理等级
     * @author YiSheep
     */
    void addNursingLevel(NursingLevel nursingLevel);

    /**
     * 根据ID查询护理等级信息
     *
     * @param id 护理等级ID
     * @return {@code NursingLevel }
     * @author YiSheep
     */
    @Select("select * from nursing_level where id = #{id}")
    NursingLevel getDetailById(Long id);

    /**
     * 更新护理等级信息
     *
     * @param nursingLevel 护理等级Dto
     * @author YiSheep
     */
    void updateNursingLevel(NursingLevel nursingLevel);

    /**
     * 删除护理等级信息
     *
     * @param id 护理等级ID
     * @author YiSheep
     */
    @Delete("delete from nursing_level where id = #{id}")
    void deleteById(Long id);

    /**
     * 查询所有护理等级信息
     *
     * @return {@code List<NursingLevel> }
     * @author YiSheep
     */
    @Select("select * from nursing_level where status = 1 order by create_time desc")
    List<NursingLevel> getAllNursingLevel();
}
